#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import QApplication  ,QWidget  , QGridLayout, QPushButton


class Winform(QWidget):
    def __init__(self, parent=None):
        super(Winform, self).__init__(parent)
        self.initui()

    def initui(self):
        # 1创建QGridLayout的实例，并设置为窗口的布局
        grid = QGridLayout()
        self.setLayout(grid)

        # 2创建按钮的标签列表
        names = ['Cls', 'Back', '', 'Close',
                 '7', '8', '9', '/',
                 '4', '5', '6', '*',
                 '1', '2', '3', '-',
                 '0', '.', '=', '+']

        # 3在网格中创建一个位置列表
        positions = [(i, j) for i in range(5) for j in range(4)]

        # 4创建按钮，并通过addWidget（）方法添加到布局中
        for position, name in zip(positions, names):
            if name == '':
                # continue
                button = QPushButton('qq')
                grid.addWidget(button, 0, 3)

            button = QPushButton(name)
            grid.addWidget(button, *position)

            self.move(300, 150)
            self.setWindowTitle('网格布局管理例子')


if __name__ == "__main__":
    # p = QuestionStore.instance()
    # question = p.get_poetry_question()
    # print(question)

    # app = QApplication(sys.argv)
    # form = Winform()
    # form.show()
    # sys.exit(app.exec_())

    # names = ['你', '我', '他']
    # po = [(i,j,m) for i in names for j in range(4) for m in range(5)]
    # for item in po:
    #     print(item)
    #     print(*item)

    print(len('左道旁门'))
